import Vue from 'vue'
import VueI18n from 'vue-i18n'
//引入Element的语言包
import locale from 'element-ui/lib/locale'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import enLocale from 'element-ui/lib/locale/lang/en'
import twLocale from 'element-ui/lib/locale/lang/zh-TW'
import Cookie from 'js-cookie'

Vue.use(VueI18n);

const i18n = new VueI18n({
  locale: Cookie.get('langs') || 'zh',
  messages:{
   
    'zh':Object.assign(require('./zh'), zhLocale),
    'en':Object.assign(require('./en'), enLocale),//将我们项目中的语言包与Element的语言包进行合并
    'tw':Object.assign(require('./tw'), twLocale),
  }
})

locale.i18n((key, value) => i18n.t(key, value));

export default i18n
